.section entry, "ax"
.globl _start
.type _start, @function

_start:
  mv s0, zero
  la sp, _stack_pointer

fsbl:
  la  t0, _ssbl_start
  la  t1, ssbl_load_addr
  la  t2, _ssbl_end
  sub t2, t2, t0

Loop1:
  bge zero, t2, fsbl_end
  lw  a1, 0(t1)
  sw  a1, 0(t0)

  addi t0, t0, 4
  addi t1, t1, 4
  addi t2, t2, -4
  j Loop1

fsbl_end:
  la t0, ssbl
  jalr x0, 0(t0)

.section .ssbl, "ax"
ssbl:
  la  t0, _text_start
  la  t1, text_load_addr
  la  t2, _data_end
  sub t2, t2, t0

Loop2:
  bge zero, t2, ssbl_end
  lw  a1, 0(t1)
  sw  a1, 0(t0)

  addi t0, t0, 4
  addi t1, t1, 4
  addi t2, t2, -4
  j Loop2

ssbl_end:
  fence.i
  la t0, _trm_init
  jalr x0, 0(t0)
